<?xml version="1.0" encoding="UTF-8" ?>
<%
/***********************************************
* 파일명 : my_vacation.jsp
* 기  능 : 휴가관리 - 휴가 조회
* 최초 작성일 : 2008/01/21
* @author : Yang Chang Hwan
*************************************************/
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib 	prefix="s" 		uri="/struts-tags"%>

<%response.addHeader("X-UA-Compatible" , "IE=EmulateIE7"); %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<s:head theme="ajax" />
	<meta http-equiv="Content-Type" 	content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" 			content="no-cache" />
	<meta http-equiv="cache-control" 	content="no-cache" />
	<meta http-equiv="expires" 			content="0" />
	
	<title>휴가 조회</title>
	
	<style type="text/css">
		.btmLine { border-bottom: 1px soild #FF0000; } 
	</style>
	<!-- --------------------J A V A S C R I P T-START-------------------- -->
	<script type="text/javascript"><!--

	/*********************************************CALENDER******************************************************/
	/////////////////////달력////////////////////////////////////////////////
		function doOnLoad()
		{
			// 달력
			cal1 = new dhtmlxCalendarObject('standard_date', false, {isYearEditable: true});
			cal1.setYearsRange(2000, 2050);
			cal1.setPosition(20,-82);
			cal1.draw();
			cal1.setOnClickHandler(selectDate1);
	
			cal2 = new dhtmlxCalendarObject('standard_date', false, {isYearEditable: true});
			cal2.setYearsRange(2000, 2050);
			cal2.setPosition(20,-82);
			cal2.draw();
			// cal2.setOnClickHandler(selectDate2);
	
			document.getElementById('standard_date').onfocus = function() { if (cal2.isVisible()) cal2.hide(); }
	
			document.body.onclick = function(){calendarHide("cal1,cal2","D");};
		}
	
		function selectDate1(date)
		{
			document.getElementById('standard_date').value = cal1.getFormatedDate(null,date);
			dateFrom = new Date(date);
			dateTo = null;
			cal2.setSensitive(dateFrom, dateTo);
			cal1.hide();
			return true;
		}
	
	/////////////////////달력////////////////////////////////////////////////
	/*********************************************CALENDER******************************************************/
	
		/*************************************************************************************************/
	    /**
	    *그룹선택이 변경될 경우에 팀과 사원  list를 변경한다.
	    */
	    function selectChange(type) {
	      
	    	if (type == "group") {
	    	  $("#sgroup").css({backgroundColor:'#3366FF', color:'#FFFFFF'});
	    	  if($("#sgroup").val()=="ALL"){
	    		  $("#sgroup").css({backgroundColor:'#ffffff',color:'#656464'});
	    	  }
				  dojo.event.topic.publish("show_team");	//팀
				  dojo.event.topic.publish("show_emp");	//사원
	    	} else if (type == "team") {
	    		$("#steam").css({backgroundColor:'#3366FF', color:'#FFFFFF'});
	    		if($("#steam").val()=="ALL"){
	    			$("#steam").css({backgroundColor:'#ffffff', color:'#656464'});
		        }
				dojo.event.topic.publish("show_emp");	//사원
	    	}
	    	else if (type == "emp")  {
	    		$("#semp_no").css({backgroundColor:'#3366FF',color:'#FFFFFF'});
	    		if($("#semp_no").val() == "ALL"){
                    $("#semp_no").css({backgroundColor:'#ffffff',color:'#656464'});
		    		}
					//dojo.event.topic.publish("show_emp");	//사원
                          
		    }
			return false;
		}

		
		/*************************************************************************************************/
		
		//ajax로 조회리스트 호출.
	    function call_dojo() {
	        dojo.event.topic.publish("ajax_list");
	    }

		//엑셀 다운로드
		function fnc_vacaExcel() {
			var f = document.frm;
			
			f.action = "vacationExcel.action";		//att_struts.xml
			f.submit();
			
			return false;		//페이지 로딩을 없게 한다.
			
		}


		//성명조회시 키를 눌렀을 때	//disabled=""
		function fnc_searchName(dis) {
			
			if (event.keyCode == 13) {
				
				if (dis.value.length < 1) {
					alert("조회하실 사원명을 입력하시기 바랍니다.") ;
					return false;
				} else {
					frm_search();
					return false;
				}
			}
			
			if (dis.value.length > 0 ) {
				$("#semp_no").attr("disabled" , "disabled");
			} else {
				$("#semp_no").removeAttr('disabled');
			}

			return false;
			
		}

		function frm_search() {
			getList('search');
			return false;
		}

	    function fnc_assign_pop(emp_no, assign_type) {

	    	var w = 595;
	       	var h = 450;
	       
	       	var x = fnc_center_x(w);
	       	var y = fnc_center_y(h);
	    
	    	var f		=	document.frm;
	    	
	    	var uri 	= 	"vacaAssign_p.action";
	    	var nm		=	"p_assign";
	    	var attr    =   "width=" + w + " , height=" + h + " , top=" + y + " , left=" + x + " , scrollbars=yes , status=no";       //window size
	    	
			if (emp_no.replace(/^\s\s*/, '').replace(/\s\s*$/, '').length != 0) {
				uri			+=	"?" + "tmp_emp_no=" + emp_no;
			}

			if (assign_type.replace(/^\s\s*/, '').replace(/\s\s*$/, '').length != 0) {
				uri			+=	"&" + "assign_type=" + assign_type;
			}
	    		
	    	window.open("" , nm , attr);
	    	
	    	f.target 	= 	nm;
	    	f.action	=	uri;
	    	
	    	f.submit();
	    	
	    	return false;
	    }

	    function fnc_vacalist_pop(emp_no, vaca_type) {

	    	var w = 600;
	       	var h = 450;
	       
	       	var x = fnc_center_x(w);
	       	var y = fnc_center_y(h);
	    
	    	var f		=	document.frm;
	    	
	    	var uri 	= 	"vacaList_p.action";
	    	var nm		=	"p_vacaList";
	    	var attr    =   "width=" + w + " , height=" + h + " , top=" + y + " , left=" + x + " , scrollbars=yes , status=no";       //window size
	    	
			if (emp_no.replace(/^\s\s*/, '').replace(/\s\s*$/, '').length != 0) {
				uri			+=	"?" + "tmp_emp_no=" + emp_no;
			}

			if (vaca_type.replace(/^\s\s*/, '').replace(/\s\s*$/, '').length != 0) {
				uri			+=	"&" + "vaca_type=" + vaca_type;
			}

	    	window.open("" , nm , attr);
	    	
	    	f.target 	= 	nm;
	    	f.action	=	uri;
	    	
	    	f.submit();
	    	
	    	return false;
	    }
	-->
	
	</script>
	<!-- --------------------J A V A S C R I P T-E N D-------------------- -->
</head>
<body onload="doOnLoad();">
<!--------- Contants Range : STR--------------->
	<div class="fl_ri">
		<div id="contants_box">
			<div id="tit">  
				<span class="fl_ri tit_navi">Home &gt; <span class="f_b">휴가조회</span><img src="/images/btl_navi.gif" class="img_tp"></img></span>
				<div class="fl_le"><img src="/images/tit_menu06.gif" /></div>
			</div>
		<s:form theme="simple"  name="frm" id="frm">
			
			<s:hidden id="cur_page" name="cur_page"/>
			<s:hidden name="emp_no" id="emp_no" />
			<s:hidden name="emp_nm" id="emp_nm" />
			<s:hidden name="group_no" id="group_no" />
			<s:hidden name="group_nm" id="group_nm" />
			<s:hidden name="team_no" id="team_no" />
			<s:hidden name="team_nm" id="team_nm" />
			<s:hidden name="authDeptCount" id="authDeptCount" />
			
			<s:if test="authDeptCount == 0" >
				<s:hidden name="sgroup" 	id="sgroup" 	value="%{group_no}" />
				<s:hidden name="steam" 		id="steam" 		value="%{team_no}" />
				<s:hidden name="semp_no" 	id="semp_no" 	value="%{emp_no}" />
				
				<s:hidden name="group_nm" />
				<s:hidden name="position_no" />
			</s:if>
			
			<!----------Search_Box : STR ---------->
			<div id="search04">
			<div id="search_box04">
				<ul>
					<li class="txt00" >휴가조회 기준일</li>
					<li class="input">
						<input type="text" size="12" maxlength="10" name="standard_date" id="standard_date" value="<s:property value="standard_date" />" class="input_100se" style="height:20;background-image:url('images/calendar/calendar.gif');background-repeat:no-repeat;background-position:right 2px;cursor:hand" />
					</li>
					<!--li class="txt01">휴가유형</li>
					<li class="input">
						<s:select name="svaca" cssClass="combobox100se"  	list="listVacation" listKey="cd" listValue="cd_nm" headerKey="ALL" headerValue="전체" />
					</li-->
				</ul>
				<ul>
					<li class="txt00">그룹</li>
					<li class="input">
						<s:if test='listGroup == null'><!-- 그룹권한이 없은 경우 -->
							<s:textfield name="group_nm" id="group_nm" cssClass="input_130s" />
						</s:if>
						<s:elseif test="emp_no in { 100 , 1 }">
							<s:select id="sgroup" 	name="sgroup" list="listGroup" cssClass="combobox100se"	listKey="group_no" listValue="group_nm" onchange="return selectChange('group')" headerKey="ALL" headerValue="::전체::"/>
						</s:elseif>
						<s:else>
							<s:select id="sgroup" 	name="sgroup" list="listGroup" cssClass="combobox100se"	listKey="group_no" listValue="group_nm" onchange="return selectChange('group')" />
						</s:else>
					</li>
					<li class="txt01">팀</li>
					<li class="input">
						<s:if test="authDeptCount == 0" >
							<s:textfield name="steam" id="steam" cssClass="input_130s" />
						</s:if>
						<s:else>
							<s:url id="team_url" action="myVacaSelectTeam_s" />
							<s:div showLoadingText="false" id="team_div" href="%{team_url}" theme="ajax" listenTopics="show_team" formId="frm"/>
						</s:else>
					</li>
					<li class="txt01">성명</li>
					<li class="input">
						<s:if test="authDeptCount == 0" >
							<s:textfield name="emp_nm" id="emp_nm"  cssClass="input_130s"/>
						</s:if>
						<s:else>
							<s:url id="emp_url" action="myVacaSelectEmp_s" />
							<s:div showLoadingText="false" id="emp_div" href="%{emp_url}" theme="ajax" listenTopics="show_emp" formId="frm" />
						</s:else>
					</li>
					<s:if test="authDeptCount != 0" >
						<li class="txt01">성명 조회</li>
						<li class="input"><input type="text" name="empNm" id="empNm" class="input_75se" maxlength="5" onkeyup="return fnc_searchName(this)"/> </li>
					</s:if>
				</ul>
				<ul>
					<li class="txt00">휴가배정 종료일</li>
					<li class="input">
						<SELECT name="free_vaca_day" class="combobox100se">
							<OPTION value="ALL" selected>::전체::</OPTION>
							<OPTION value="4" class="comboboxVaca">4개월</OPTION> 
							<OPTION value="3" class="comboboxVaca">3개월</OPTION>
							<OPTION value="2" class="comboboxVaca">2개월</OPTION>
							<OPTION value="1" class="comboboxVaca">1개월</OPTION> 
						</SELECT>						
					</li>
					<li class="txt01">재직여부</li>
					<li class="input">
						<SELECT name="work_yn" class="combobox80se">
							<OPTION value="ALL">::전체::</OPTION>
							<OPTION value="Y" selected class="comboboxVaca">Y</OPTION> 
							<OPTION value="N" class="comboboxVaca">N</OPTION> 
						</SELECT>
					</li>
				</ul>
				<ul class="cebtn" >
					<span class="fl_ri">
						<img src="/images/btn_search.gif" style="vertical-align: middle;cursor:pointer;" onclick="return frm_search()" />
						<img src="/images/btn_excel.gif" style="vertical-align: middle;cursor:pointer;"  onclick="fnc_vacaExcel()" />
					</span>
				</ul>
			</div>
			</div>	
			<!----------Search_Box : ENd ---------->  
		<!-- ajax로 데이터를 조회해 온다. -->
		<center>
		<s:url id="ajax_list"  action="ajax_myvacation_list" />
		<s:div id="itemAmtlistDiv" theme="ajax" executeScripts="true" showLoadingText="true" loadingText='<img src="./images/loading_request.gif" />' href="%{ajax_list}" listenTopics="ajax_list" formId="frm" />
		</center>	
		</s:form>
		</div>
	</div>
</body>
</html>